# This file is part of BlackArch Linux ( https://www.blackarch.org/ ).
# See COPYING for license details.

pkgname=admsnmp
_pkgname=ADMsnmp
pkgver=0.1
pkgrel=5
groups=('blackarch' 'blackarch-scanner')
pkgdesc='ADM SNMP audit scanner.'
license=('GPL')
depends=('glibc')
arch=('x86_64' 'aarch64')
source=("https://dl.packetstormsecurity.net/groups/ADM/ADMsnmp.$pkgver.tgz"
        'snmp.c.patch')
sha512sums=('e861174206b87934ad14f686a5f0abc0d1350b94b535075b9d75d9c79411be6dd298cb2f496140541603025217d275fb80a6429f653bd3735e098b7cb6c0282e'
            '314dc6faf110b9094120b05dc1ebc4746aef2b273dc82825c4a58836017e80b4158f0539f7049c23c8d35a2f9b52ad5f831729524c4672d3b14a276db482d647')

prepare() {
  cd $_pkgname

  patch -p0 < "$srcdir/snmp.c.patch"
}

build() {
  cd $_pkgname

  gcc $CFLAGS snmp.c -o $pkgname
}

package() {
  cd $_pkgname

  install -dm 755 "$pkgdir/usr/share/$pkgname"

  install -Dm 755 $pkgname "$pkgdir/usr/bin/$pkgname"
  install -Dm 644 -t "$pkgdir/usr/share/$pkgname/" snmp.passwd \
    "$_pkgname.README"
}

